package com.chenx.gameview;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import android.R.integer;
import android.graphics.Bitmap;

import com.chenx.gameinterface.GameImage;

public class ZiDanImage implements GameImage
{

	private FeJiImage feiji;
	private int display_w, display_h;
	private int index = 0;
	private int changenum = 0;
	private ArrayList<ZiDanImage> zidans = new ArrayList();
	private Bitmap zidan = null;

	private int x, y, width, height;

	public ZiDanImage(FeJiImage feiji, Bitmap zidan, int display_w,
			int display_h, ArrayList<ZiDanImage> zidans, int x)
	{
		this.feiji = feiji;
		this.zidans = zidans;
		this.display_w = display_w;
		this.display_h = display_h;

		this.zidan = zidan;

		this.x = 0 - 100;
		this.y = (feiji.getY() - zidan.getHeight()) + 20;

		// bitmaps.add(Bitmap.createBitmap(diren, 0, 0, diren.getWidth() / 4,
		// diren.getHeight()));
		// bitmaps.add(Bitmap.createBitmap(diren, (diren.getWidth() / 4) * 1, 0,
		// diren.getWidth() / 4, diren.getHeight()));
		// bitmaps.add(Bitmap.createBitmap(diren, (diren.getWidth() / 4) * 2, 0,
		// diren.getWidth() / 4, diren.getHeight()));
		// bitmaps.add(Bitmap.createBitmap(diren, (diren.getWidth() / 4) * 3, 0,
		// diren.getWidth() / 4, diren.getHeight()));

		// y = -diren.getHeight();
		// Random ran = new Random();
		// x = ran.nextInt(display_w - (diren.getWidth() / 4));

	}

	@Override
	public Bitmap getBitmap()
	{
		x += 110;
		y -= 20;
		// if (y <= -10)
		// {
		// zidans.remove(this);
		// }
		if (x >= display_w+100)
		{
			zidans.remove(this);
		}
		// TODO Auto-generated method stub
		return zidan;
	}

	public int getWidth()
	{
		return width;
	}

	public int getHeight()
	{
		return height;
	}

	@Override
	public int getX()
	{
		// TODO Auto-generated method stub
		return x;
	}

	@Override
	public int getY()
	{
		// TODO Auto-generated method stub
		return y;
	}
}
